-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add context menu for multi-file entries (#12567) #13726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add context menu for multi-file entries (#12567) #13726
Conversation
Extend the Entry Editor context menu to handle entries with multiple linked files. This improves UX when managing more than one file per entry and aligns behavior across single- and multi-file scenarios. Changes: - Add plural actions to StandardActions enum - Rewrite ContextAction.execute() for multi-file cases - Extend ContextMenuFactory to build multi-file items - Rework MultiContextAction to operate on selections - Introduce CopyMultipleFilesAction (new class) - Update/add localization keys; tests pass - Add unit tests: ContextActionTest, ContextMenuFactoryTest, MultiContextActionTest, CopyMultipleFilesActionTest - Guard LinkedFileViewModel to avoid a JavaFX crash Fixes JabRef#12567 Keywords: context menu, linked files, multi-selection, UI
jabgui/src/main/java/org/jabref/gui/copyfiles/CopyMultipleFilesAction.java
Outdated
Show resolved
Hide resolved
jabgui/src/test/java/org/jabref/gui/fieldeditors/contextmenu/MultiContextActionTest.java
Outdated
Show resolved
Hide resolved
jabgui/src/test/java/org/jabref/gui/fieldeditors/contextmenu/MultiContextActionTest.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/copyfiles/CopyMultipleFilesAction.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/copyfiles/CopyMultipleFilesAction.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/MultiContextAction.java
Outdated
Show resolved
Hide resolved
|
Hi @koppor, all checks have passed ✅ Could you please review and approve when you have time? |
Check this setting on the right (screenshot taken from here) |
jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/MultiContextAction.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jabgui/src/main/java/org/jabref/gui/actions/StandardActions.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/copyfiles/CopyMultipleFilesAction.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/MultiContextAction.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/MultiContextAction.java
Outdated
Show resolved
Hide resolved
jabgui/src/test/java/org/jabref/gui/copyfiles/CopyMultipleFilesActionTest.java
Outdated
Show resolved
Hide resolved
jabgui/src/test/java/org/jabref/gui/copyfiles/CopyMultipleFilesActionTest.java
Outdated
Show resolved
Hide resolved
jabgui/src/test/java/org/jabref/gui/fieldeditors/contextmenu/ContextMenuFactoryTest.java
Outdated
Show resolved
Hide resolved
|
I mean reuse existing commands with changed text: eg 'Download file(s)' |
|
Thx for your feedback, i will research the problems you marked and try to solve, if it`s possible, thx a lot |
…sActionTest.java Co-authored-by: Carl Christian Snethlage <[email protected]>
…menu - Introduce ContextMenuBuilder + SingleSelectionMenuBuilder + MultiSelectionMenuBuilder - Extract shared checks/openContainingFolders into SelectionChecks - ContextMenuFactory delegates to strategies; no more branching by selection size - LinkedFilesEditor initializes ContextMenuFactory once and just requests menus on right-click - Replace plural menu commands with single StandardActions; multi-selection handled inside builders - Fix NPE in ContextAction executable binding by removing null observables and binding menu disable state properly - Remove obsolete MultiContextAction and its tests Follow-ups: - Convert hardcoded labels to i18n keys (Download file(s), Open folder(s), etc.) - Consider removing *_FILES actions from enum if unused elsewhere - Re-add unit tests around builders/factory (TestFX/JUnit5) once API stabilized
|
All the review has been done, i will test it manually and do unit test, after make a PR if all is OK |
|
Hi, i think the next iteration will probably be the last one. I just made some quick refactorings to ContextMenuFactoryTest to make it a bit more readable. It was just like a wall that hit me will all the declarations in the single tests. Please apply the suggested changes. After that, we will finish this PR and get it merged. Most is already good and you did a great job in this PR. |
|
yes |
|
@koppor @calixtus @subhramit about merging to package ...logic. Would you mind if i create package in org,jabref.logic ---> or.jabref.logic.files Other way - i found LinkedFileHandler in package org.jabref.logic.externalfiles Or i even can make in this package additional file as LinkedFileCopier, for example What do you prefer? I will do LinkedFileCopier in externalfiles package for now, after your answer we will see
|
|
Hey, we briefly talked about the refactoring, @koppor suggested. We think we should do this in a follow-up. So forget about moving stuff to logic and just polish this one. Then we finalize and merge. |
|
don't forget the openrewrite test |
Yes, sure, i will check submodules, do rewrite and changelog, ty for notifying |
|
What i did: 1.ContextMenuFactory - added jspecify NonNull and deleted static import, using Object now (Objects.requireNonNull(selection, "...")
Now i will run all tests, test it in application finally and do commit soon! |
|
You may have forgotten to push your commit. |
No-no, I`m sick now (ill), no energy for coding now, i will polish it soon do not worry |
|
Oh ok, sorry. Get well soon! |
|
You need to merge in the latest main, then it will be resolved |
|
@calixtus Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
|
Hooray! |







Extend the Entry Editor context menu to handle entries with multiple linked files. This improves UX when managing more than one file per entry and aligns behavior across single- and multi-file scenarios.
Changes:
MultiSelectionMenuBuilderTest, SelectionChecksTest
Fixes #12567
Keywords: context menu, linked files, multi-selection, UI
Steps to test
Mandatory checks